//
//  SafeCodeViewController.m
//  Vpay
//
//  Created by 伟大大 on 2018/10/20.
//  Copyright © 2018年 丁伟佳. All rights reserved.
//

#import "SafeCodeViewController.h"

@interface SafeCodeViewController ()

@end

@implementation SafeCodeViewController

#pragma mark -
#pragma mark - for lifeCircle
#pragma mark -
- (void)viewWillAppear:(BOOL)animated {
    
    [super viewWillAppear:animated];
    
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    
    //    [self.navigationController setNavigationBarHidden:YES animated:NO];
    
}

- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
    //    [self.navigationController setNavigationBarHidden:NO animated:NO];
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"设置安全口令";
    self.view = [[[NSBundle mainBundle]loadNibNamed:@"SafeCodeViewController" owner:self options:nil]lastObject];
    self.view.backgroundColor = BACKCOLOR;
    
    
    
    //    [self initData];
    [self initNavBtns];
    [self initViews];
    
    //    [NSThread detachNewThreadSelector:@selector(requestData) toTarget:self withObject:nil];
    
    //    [NSThread detachNewThreadSelector:@selector(requestDingdanData) toTarget:self withObject:nil];
}
#pragma mark -
#pragma mark - for Views
#pragma mark -

- (void)initNavBtns {
    
    self.navigationItem.leftBarButtonItem = [AppUtility getNavBtnItemLefBacktWith:@selector(leftNavBtnClicked) andTarget:self];
}
- (void)initViews {
    self.SafeCode_textfiled.delegate = self;
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(TapAction)];
    [self.view addGestureRecognizer:tap];
}

#pragma mark -
#pragma mark for evevts
#pragma mark -
- (void)leftNavBtnClicked {
    
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)TapAction {
    
    if ([_SafeCode_textfiled isFirstResponder]) {
        [_SafeCode_textfiled resignFirstResponder];
    }
    
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (void)dealloc {
    [_SafeCode_textfiled release];
    [_Next_btnClik release];
    [super dealloc];
}
- (IBAction)Next_btnClik:(UIButton *)sender {
    if (![AppUtility judgePassWordLegal:_SafeCode_textfiled.text]) {
        [self.view makeToast:@"安全口令必须是8~20位(包含数字和字母)"];
        return;
    }
}
@end
